class Solution {
public:
    int maxVowels(string s, int k) {
        int left = 0, right = 0, cont = 0, ret = 0;
        while (k) {
            if (s[right] == 'a' || s[right] == 'e' || s[right] == 'i' ||
                s[right] == 'o' || s[right] == 'u') {
                cont++;
            }
            right++;
            k--;
        }
        ret = max(ret, cont);
        for (; right < s.size(); right++)
        {
            if (s[left] == 'a' || s[left] == 'e' || s[left] == 'i' ||
                s[left] == 'o' || s[left] == 'u')
            {
                cont--;
            }
            left++;
            if (s[right] == 'a' || s[right] == 'e' || s[right] == 'i' ||
                s[right] == 'o' || s[right] == 'u') {
                cont++;
            }
            ret = max(ret, cont);
        }
        return ret;
    }
};